package com.lg.erp.service.impl.chenximou;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lg.erp.entity.chenximou.Order;
import com.lg.erp.mapper.chenximou.OrderMapper;
import com.lg.erp.service.chenximou.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {
    
    @Autowired
    private OrderMapper orderMapper;
    
    @Override
    public IPage<Order> selectOrderByPage(Page<Order> page,String key) {
        return orderMapper.selectOrderByPage(page,key);
    }

    @Override
    public List<Order> selectAllOrder() {
        return orderMapper.selectAllOrder();
    }

    @Override
    public boolean removeOrderById(String id) {
        return orderMapper.removeOrderById(id);
    }

    @Override
    public boolean saveOrder(Order order) {
        return orderMapper.saveOrder(order);
    }

    @Override
    public boolean updateOrder(Order order) {
        System.out.println(order.getCustomId());
        return orderMapper.updateOrder(order);
    }

    @Override
    public List<Order> selectOrderByConditions(String orderId, String dateValue) {
        return orderMapper.selectOrderByConditions(orderId,dateValue);
    }

    @Override
    public List<Order> selectOrderByStatus(Order order) {
        return orderMapper.selectOrderByStatus(order);
    }

    @Override
    public List<Order> selectOrderByStatus2(Order order) {
        return orderMapper.selectOrderByStatus2(order);
    }

    @Override
    public IPage<Order> selectOrderByStatusPage(Page<Order> page,Order order,String key) {
        String[] split = order.getOrderStatus().split(",");
        String num1=split[0];
        String num2=split[1];
        return orderMapper.selectOrderByStatusPage(page,num1,num2,key);
    }

    @Override
    public boolean updateOrderStatusById(Order order) {
        return orderMapper.updateOrderStatusById(order);
    }


}
